package makabakaquestionnaire.zutsoftware.controller;

import makabakaquestionnaire.zutsoftware.service.IProjectTemplateItemService;
import makabakaquestionnaire.zutsoftware.service.IProjectTemplateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("template")
public class TemplateProjectController {
    @Autowired
    public IProjectTemplateService projectTemplateService;
    @Autowired
    public IProjectTemplateItemService templateItemService;

    /**
     * 将已创建的评价问卷生成为模板1
     */
//    @PostMapping("/save")
//    public Result saveAsProjectTemplate(@RequestBody UserProject request, @RequestAttribute Long userId) {
//        UserProject userProject = userProjectService.queryProjectByProKey(request.getProjectKey());
//        List<ProjectItem> itemEntityList = projectItemService.queryProjectItemByProKey(request.getProjectKey());
//        TemplateProject templateProject = new TemplateProject();
//        templateProject.setProjectKey(UUidUtil.getSimpleUUID());
//        templateProject.setCategoryId(4L); //4为其他，后面可以搞个枚举类型来表示
//
//        templateProjectService.insertProject(templateProject);//考虑改为mq情况，包装为消息：key放在message的bod里，另一个系统里，消费者拿着key可得到project和item，分别将他们保存在模板的数据库中
//        itemEntityList.forEach(item -> item.setProjectKey(templateProject.getProjectKey()));
//        templateProjectItemService.save(projectTemplateItemList);
//        return Result.success(templateProject.getProjectKey());
//    }



}
